package controllers;

import java.io.IOException;
import java.util.ArrayList;

import common.CheckBoxObject;
import ccrm.ClientMain;
import entitys.Request;
import entitys.Session;
import enums.Command;

public class initiateSaleController {

	public static void getSalesPersons()
	{
		
		//Request r =new Request(Command.GET_PRODUCTS,"123",sector +"@"+type);
		Request r =new Request(Command.GET_SALE_PERSONS,Session.getEmployee().getUserId());
		
		try {
			ClientMain.client.sendToServer(r);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
	}
	public static void getMarketingPatterns()
	{
		
		//Request r =new Request(Command.GET_PRODUCTS,"123",sector +"@"+type);
		Request r =new Request(Command.GET_MARKETING_PATTERNS,Session.getEmployee().getUserId());
		
		try {
			ClientMain.client.sendToServer(r);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
	}
	public static void getPatternedClients()
	{
		
		//Request r =new Request(Command.GET_PRODUCTS,"123",sector +"@"+type);
		Request r =new Request(Command.GET_PATERNED_CLIENTS,Session.getEmployee().getUserId());
		
		try {
			ClientMain.client.sendToServer(r);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
	}
	public static void getPatternedClients(String patternID)
	{
		
		//Request r =new Request(Command.GET_PRODUCTS,"123",sector +"@"+type);
		Request r =new Request(Command.GET_PATERNED_CLIENTS,Session.getEmployee().getUserId(),patternID);
		
		try {
			ClientMain.client.sendToServer(r);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
	}
	public static void initiateNewSale(ArrayList<ArrayList<CheckBoxObject>> salesPersonToCustomer,String patternID)
	{
		
		//Request r =new Request(Command.GET_PRODUCTS,"123",sector +"@"+type);
		Request r =new Request(Command.ADD_NEW_SALE,Session.getEmployee().getUserId(),salesPersonToCustomer,patternID);
		
		try {
			ClientMain.client.sendToServer(r);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
	}
	
}
